//
//  MineChongZhiController.swift
//  HappyEat
//
//  Created by ctx2016 on 17/1/13.
//  Copyright © 2017年 陌路是我. All rights reserved.
//

import UIKit

class MineChongZhiController: UIViewController ,UITableViewDelegate,UITableViewDataSource{
    
    let cellId:String = "CellId"
    
    var tableView:UITableView = UITableView.init()

    override func viewDidLoad() {
        super.viewDidLoad()
        self.createTableView()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.setNavi()
    }
}
extension MineChongZhiController{
    //MARK:设置导航栏选项
    func setNavi(){
        self.navigationItem.title = "充值记录"
        self.navigationController?.navigationBar.barTintColor = .red
        self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.black]
        self.navigationItem.leftBarButtonItem = UIBarButtonItem.init(title: "", imagStr: "ic_back", fontSize: 14, target: self, action: #selector(leftBarButtonAction))
    }
    //MARK:LeftBarButtonAction
    func leftBarButtonAction(){
        self.navigationController!.popViewController(animated: true)
}
    func createTableView(){
        self.view.addSubview(self.tableView)
        self.tableView.snp.makeConstraints { (make) in
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.top.equalTo(0)
            make.bottom.equalTo(0)
        }
        self.tableView.delegate = self
        self.tableView.dataSource = self
        self.tableView.register(MineChongZhiRecoderCell.self, forCellReuseIdentifier: cellId)
    }
    @objc(numberOfSectionsInTableView:) func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10
    }
    @objc(tableView:heightForRowAtIndexPath:) func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return (48 + 16 + 28)
    }
    @objc(tableView:cellForRowAtIndexPath:) func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        var cell = tableView.dequeueReusableCell(withIdentifier: cellId)
        (cell as!MineChongZhiRecoderCell).titleLabel.text = "订单号：1212121212121"
        (cell as!MineChongZhiRecoderCell).infoLabel_left.text = "50徽币"
        (cell as!MineChongZhiRecoderCell).infoLabel_center.text = "微信支付"
        (cell as!MineChongZhiRecoderCell).infoLabel_right.text = "充值成功"
        (cell as!MineChongZhiRecoderCell).timeLabel.text = "2017-08-23"
        return cell!
    }
}
